﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonExtensions.ObjectExtensions;
using CommonExtensions.StringExtensions;

namespace DBMigrator.Core.DbObjects.Data.Select.From.Join
{
    public class JoinTable : IJoinTable
    {
        public string TableName { get; private set; }
        public string ColumnName { get; private set; }
        public IFromTable FromTable { get; private set; }
        
        public JoinTable(IFromTable fromTable)
        {
            if(fromTable.IsNull())
                throw new ArgumentNullException("fromTable");

            FromTable = fromTable;
        }

        public IFromTable IsEqualTo(string tableName, string columnName)
        {
            if(tableName.IsBlank())
                throw new ArgumentNullException("tableName");
            if(columnName.IsBlank())
                throw new ArgumentNullException("columnName");

            TableName = tableName;
            ColumnName = columnName;

            return FromTable;
        }
    }
}
